package 线程创建的第二种方式;/**
 * @作者:侯国威
 * @时间: 2020/4/10/18:23
 * @邮箱:1045077189@qq.com
 */

 class deom {
    public static void main(String[] args) {
        add a =new add();
        a.start();

        even even=new even();
        even.start();
    }
}
class add extends Thread{
    @Override
    public void run() {
        int sum =0;
        Thread.currentThread().setName("我是一");
            for (int i=0;i<100;i++){
                if (i %2!=0){
                    sum += i;
                }

            }
        System.out.println("技术和:"+sum+currentThread().getName());
        System.out.println(currentThread().getPriority());
    }

}
class even extends Thread{

    public void run() {
        Thread.currentThread().setName("我是二");
        int sum =0;
        for (int i=0;i<100;i++){
            if (i %2==0){
                sum += i;
            }

        }
        System.out.println("偶数和:"+sum+currentThread().getName());
        System.out.println(currentThread().getPriority());
    }
}
